import 'package:flustars/flustars.dart';
import 'package:flutter/material.dart';
import 'package:flutter_design/com/zerogis/flutterdesign/constant/PluginInitParamKeyConstant.dart';
import 'package:flutter_design/com/zerogis/flutterdesign/widget/core/WidgetCreator.dart';
import 'package:weui/weui.dart';
import 'package:zpub_bas/com/zerogis/zpubbase/constant/DigitValueConstant.dart';
import 'package:zpub_bas/com/zerogis/zpubbase/constant/MarginPaddingHeightConstant.dart';
import 'package:zpub_plugin/com/zerogis/zpubPlugin/widget/WidgetStatefulBase.dart';
import 'package:zpub_bas/zpub_bas.dart';


/*
 * 主页(框架用例) <br/>
 * 需要传入的键：<br/>
 * 传入的值类型： <br/>
 * 传入的值含义：<br/>
 * 是否必传 ：
 */
class HomeWidget4 extends WidgetStatefulBase
{
  HomeWidget4({Key key, plugin}) : super(key: key, plugin: plugin);

  State<StatefulWidget> createState()
  {
    return new HomeWidgetState();
  }

  static String toStrings()
  {
    return "HomeWidget4";
  }
}

/*
 * 页面功能 <br/>
 */
class HomeWidgetState extends WidgetBaseState<HomeWidget4>
{
  /*
   * 组件中的孩子组件
   */
  List<Widget> m_WidgetList;

  void initState()
  {
    super.initState();
    initData();
    m_WidgetList = createChildrenKeyWidget();
  }


  Widget build(BuildContext context)
  {
    return createCommonRefresh(new Column(
      children: <Widget>[
        new WeSwipe(
            width: ScreenUtil
                .getInstance()
                .screenWidth,
            height: MarginPaddingHeightConstant.APP_MARGIN_PADDING_232,
            autoPlay: false,
            itemCount: 1,
            indicators: false,
            itemBuilder: (index)
            {
              return WidgetCreator.createCommonImage(
                "https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=3505225179,3679565771&fm=26&gp=0.jpg",
                fit: BoxFit.fitWidth, alignment: Alignment.topCenter,
              );
            }
        ),
        new Card(
            margin: const EdgeInsets.only(left: 19, right: 19, top: 15),
            child: m_WidgetList[DigitValueConstant.APP_DIGIT_VALUE_1]),
        new Card(
            margin:
            const EdgeInsets.only(left: 19, right: 19, top: 20, bottom: 15),
            child: m_WidgetList[DigitValueConstant.APP_DIGIT_VALUE_2]),
      ],
    ));
  }

  void onNetWorkSucceed(String method, Object values)
  {
    if (method == "queryMyTaskMax")
    {

    }
    else
    {
      super.onNetWorkSucceed(method, values);
    }
  }

  void onNetWorkFaild(String method, Object values)
  {
    if (method == "queryHrClockin")
    {

    }
    else
    {
      super.onNetWorkFaild(method, values);
    }
  }

  @override
  Future<void> onRefresh()
  {
    return super.onRefresh();
  }

  @override
  Future<void> loadMore()
  {
    return super.loadMore();
  }
}



/*
 * 类描述：首页组件提供的Service
 * 作者：郑朝军 on 2019/6/6
 * 邮箱：1250393285@qq.com
 * 公司：武汉智博创享科技有限公司
 * 修改人：郑朝军 on 2019/6/6
 * 修改备注：
 */
class HomeWidget4Service extends InterfaceBaseImpl
{
  @override
  Widget runWidget({dynamic initPara})
  {
    return new HomeWidget4();
  }
}
